﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="persondoc_folder_edit.aspx.cs" Inherits="Ccit.OA.PersonDoc.persondoc_folder_edit" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.1" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.1" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>文件夹编辑页面</title>
    <link href="css/enter.css" rel="stylesheet" type="text/css">
    <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script type="text/javascript">
         function doSelUser(vRagneId,vCtrlId,vCtrlName) {
                OpenRangeSelect(vRagneId,vCtrlId,vCtrlName,"1");
          }
          function doSave(oType)
          {
              var vName = document.getElementById("txtName").value;
              if(vName.Trim()!="")
              {
                   var vFid = document.getElementById("_hidFId").value;
                   var vSuperiorId = document.getElementById("_hidSuperiorId").value;
                   var MsFolder = {}; //消息对象
                   MsFolder.FId = vFid;
                   MsFolder.FName = vName;
                   MsFolder.UserId = $get("_hidUserId").value;
                   MsFolder.Superiorid = vSuperiorId;
                   var rbtn = new RadioList("radioList");
                   MsFolder.Sharingmark = rbtn.checkedValue;
                   MsFolder.Readmark= $get("_hidReadMark").value;
                   MsFolder.ReadId= $get("_hidReadId").value;
                   parent.frames[0].document.getElementById("_hidShare").value
                   MsFolder.CompleteyMark= $get("_hidCompleteyMark").value;
                   MsFolder.CompleteyId= $get("_hidCompleteyId").value;
                   MsFolder.Url = $get("_hidUrl").value;
                   
                   var jsonExpr = JSON.stringify(MsFolder,function(key,value){return value;}); 
                      MsFolder = null;
                   PageMethods.DoSave(jsonExpr,oType,ClientBack); 
              }
              else
              {
                alert("您尚未输入文件夹名称,请输入!")
                return ;
              }
          }
          function ClientBack(vResult)
          {
                var rbtn = new RadioList("radioList"); 
                if(rbtn.checkedValue=="1")
                {
                    parent.frames[0].document.getElementById("_hidShare").value = "-1";
                }
              
           var oXMLDoc = new ActiveXObject("Microsoft.XMLDOM");  
                    oXMLDoc.loadXML(vResult); 
                    var vExeResult = $(oXMLDoc).find("EXERESULT").text();  //result   
                 eval("var resultObj=" + vResult);
                    var rId = resultObj.resultID;  
                    var isAddNew = resultObj.ctrtype;  //是否是新增记录标志  0:是 1:否   
                    
                    if(parseInt(rId) > 0) {
                        $get("_hidSuperiorId").value = resultObj.Superiorid; //上级文件夹ID     
                        $get("_hidFId").value = rId;   //当前文件夹ID
                        $get("txtName").value = resultObj.FName;    //文件夹编号
                        //////实例化MsFolder消息对象
                        var MsFolder = {};
                        MsFolder.FId= $get("_hidFId").value;
                        MsFolder.FName = $get("txtName").value;
                        MsFolder.Superiorid = $get("_hidSuperiorId").value;
                        MsFolder.FType = "";
                       
                        var jsonExpr=JSON.stringify(MsFolder,function(key,value){return value;});
                        }
                        /////////////////////
         
                    if(resultObj.resultID!="-999")
                    {
                         parent.frames[0].document.getElementById("_hidNewColumnId").value=jsonExpr;
                         parent.frames[0].document.getElementById("_hidAddNewSign").value = resultObj.ctrtype;  //新增记录标志
                         parent.frames[0].document.getElementById("_hidUpAddrId").value = resultObj.Superiorid;
                         parent.frames[0].document.all.btnTrigger.click(); 
                         if(resultObj.OperateType == "3")
                         {
                            doBack();
                         }   
                         else if(resultObj.OperateType == "2")
                         {
                            var strURL = "persondoc_folder_edit.aspx";
                            document.location.href = strURL;
                         }
                    }
                    else
                    {
                        alert(resultObj.message)
                    }
                    resultObj = null;
          }
          function doClear()
          {
                $get("_hidSuperiorId").value = "";
                $get("_hidFId").value="";
                $get("_hidUserId").value ="";
                $get("txtName").value="";
                $get("_hidReadMark").value="";
                $get("_hidReadId").value="";
                $get("_hidCompleteyMark").value=""; 
                $get("_hidCompleteyId").value="";
                $get("txtCompletey").value="";
                $get("txtRead").value=""; 
                $get("_hidUrl").value = "";
          }
          function doBack()
          { 
                
                var sParam = "folderID=" + document.getElementById("_hidSuperiorId").value+"&UserIdShare=" + document.getElementById("_hidUserId").value;
		        var encodeParam = base64encode(sParam);
                parent.frames[1].location.href = "./persondoc_mydoc_list.aspx?"+encodeParam;
          }
        function doMenu()
        {
            window.parent.doMenuNone();
        }
          function doSelect()
          {
               var rbtn = new RadioList("radioList"); 
               if(rbtn.checkedValue=="0")
               {
                    document.getElementById("lnbRead").href="#";
                    document.getElementById("lnbCompletey").href="#";
               }
               else
               {
                   document.getElementById("lnbRead").href="javascript:doSelUser('_hidReadId','_hidReadMark','txtRead')";
                   document.getElementById("lnbCompletey").href="javascript:doSelUser('_hidCompleteyId','_hidCompleteyMark','txtCompletey')"; 
               }
          }
          function doClose()
          {
            window.close();
          }
    </script>
</head>
<body onload="doMenu()">
    <ccit:ActionForm id="form1" runat="server">
    <input type="hidden" id="_hidSuperiorId" runat="server" />
    <input type="hidden" id="_hidFId" runat="server" />
    <input type="hidden" id="_hidUrl" runat="server" />
    <input type="hidden" id="_hidUserId" runat="server" />
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager> 
   <table  style="background-color: #E8E8E8;"  cellpadding="0" cellspacing="0" width="98%" align="center">
                    <tr>
                        <td align="left">
                            <div class="tbSeparator"></div>
                        </td>
                        <td width="100%" class="titlebar"> 
                        文件夹编辑页面  
                        </td>                
                        <td align="right">

                        </td> 
                    </tr>
       </table>
       <table  class="tableborder" cellpadding="0" cellspacing="0" width="98%" align="center" runat="server">
                          <tr>
                            <td width="15%" valign="top" class="pformleft" align="right">文件名称</td>
                            <td class="pformright">
                                  <asp:TextBox ID="txtName" CssClass="input" runat="server" Width="90%"></asp:TextBox>
                                 </td>
                          </tr>
                          <tr>
                            <td width="15%"  class="pformleft" align="right">共享标志</td>
                            <td class="pformright">
                                <asp:RadioButtonList ID="radioList" runat="server" RepeatDirection="Horizontal" onclick ="doSelect()">
                                    <asp:ListItem Value="0" Selected>不共享此文件</asp:ListItem>
                                    <asp:ListItem Value="1">共享此文件</asp:ListItem>
                                </asp:RadioButtonList>
                                </td>
                          </tr>
                          <tr>
                            <td width="15%"  class="pformleft" align="right">共享设置</td>
                            <td class="pformright" >
                                    <nobr>
                                         <input type="hidden" id="_hidReadId" runat="server" />
                                         <input type="hidden" id="_hidReadMark" runat="server" />  
                                         <a  id="lnbRead" Runat="server" class="linktext"  
                                            href="javascript:doSelUser('_hidReadId','_hidReadMark','txtRead')">
							                    <img src="../images/toolbar/search.gif" border="0">只读共享设置
						                  </a>
                                    </nobr>
                               </td>
                          </tr>
                          <tr>
                            <td width="15%"  class="pformleft" align="right">&nbsp;</td>
                            <td class="pformright" >
                                    <asp:TextBox ID="txtRead" TextMode="MultiLine" Width="98%" Height="90px" 
                                        runat="server" ReadOnly="true" CssClass="inputtext"></asp:TextBox> 
                                 </td>
                          </tr>
                          <tr>
                            <td width="15%"  class="pformleft" align="right">&nbsp;</td>
                            <td class="pformright" >
                                    <nobr>
                                         <input type="hidden" id="_hidCompleteyId" runat="server" />
                                         <input type="hidden" id="_hidCompleteyMark" runat="server" />
                                         <a  id="lnbCompletey" Runat="server" class="linktext"  
                                            href="javascript:doSelUser('_hidCompleteyId','_hidCompleteyMark','txtCompletey')">
							                    <img src="../images/toolbar/search.gif" border="0">完全共享设置
						                  </a>
                                    </nobr>
                             </td>
                          </tr>
                          <tr>
                            <td width="15%"  class="pformleft" align="right">&nbsp;</td>
                            <td class="pformright" >
                                     <asp:TextBox ID="txtCompletey" TextMode="MultiLine" Width="98%" Height="90px" 
                                        runat="server" ReadOnly="true" CssClass="inputtext"></asp:TextBox> 
                            </td>
                          </tr>
                          <tr class="pformstrip">
                           <td colspan="2" align="center" >
                           <nobr>
                                <input type="button" id="btnSave" value="保存" class="button" onclick="doSave('1')" />
                                <input type="button" id="btnSaveCont" value="保存并新增" class="button" onclick="doSave('2')" />
                                <input type="button" runat="server" id="btnSaveBack" value="保存并返回" class="button" onclick="doSave('3')" />
                                <input type="button" runat="server" id="btnBack" value="返回" class="button" onclick="doBack()" />
                                <input type="button" runat="server" id="btnClose" value="关闭" class="button" onclick="doClose()" />
                                </nobr>
                            </td>
        </tr>
       </table>
    </ccit:ActionForm>
    <script type="text/javascript">
    <!--
        $(document).ready(function(){   
             var rbtn = new RadioList("radioList"); 
             var r =  document.getElementById("radioList");
             var vread = document.getElementById("lnbRead");
               if(rbtn.checkedValue=="0")
               {
                    document.getElementById("lnbRead").href="#";
                    document.getElementById("lnbCompletey").href="#";
               }
               else
               {
                   document.getElementById("lnbRead").href="javascript:doSelUser('_hidReadId','_hidReadMark','txtRead')";
                   document.getElementById("lnbCompletey").href="javascript:doSelUser('_hidCompleteyId','_hidCompleteyMark','txtCompletey')"; 
               }
        }); 
    //-->
    </script>
</body>
</html>
